%This file creates the data for Figure 6d and saves it in
%\Replication_files\mat_files\fig6d_data.mat

clear
cd ../mat_files

for rho_g_2=0:0.02:0.7
    cd ../m_files
    set_parameters(2.48,0,0.98+rho_g_2,-rho_g_2,0.8,15,0,1,8);
    cd ../mod_files
    dynare a15_markups.mod
    corr_w_inertia=zeros(17,1);
    for i=-8:1:8
        corr_w_inertia(i+9)=corr(mu(9+i:9992+i),y(9:9992)); 
    end
    cd ../mat_files
    if rho_g_2==0
        correlations=corr_w_inertia;
    else
        load('fig5d_data.mat');
        correlations=[correlations corr_w_inertia];
    end
    save('fig5d_data.mat','correlations');
end

cd ../m_files